home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
pwrclib.exe
/
REPCHAR.C
< prev
next >
Wrap
Text File
|
1992-09-01
|
640b
|
28 lines
/* repchar function Copyright 1992 by Chuck Steenburgh
This function will replace all instances of a given character
in a string with another
repchar accepts the following arguments:
char *s - string in which character(s) are to be replaced
char c - character to be replaced
char r - replacement character
Returns: number of character replaced
*/
int repchar(char *s, char c, char r)
{
/* local variable */
int counter=0;
while (s = strchr(s,c)) {
*s = r;
counter++;
}
return counter;
}